package com.ruoyi.qiushi.service.mall.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.qiushi.domain.mall.TradeOrderItem;
import com.ruoyi.qiushi.mapper.mall.TradeOrderItemMapper;
import com.ruoyi.qiushi.service.mall.ITradeOrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 交易订单明细Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-25
 */
@Service
public class TradeOrderItemServiceImpl implements ITradeOrderItemService {
    @Autowired
    private TradeOrderItemMapper tradeOrderItemMapper;

    /**
     * 查询交易订单明细
     *
     * @param id 交易订单明细主键
     * @return 交易订单明细
     */
    @Override
    public TradeOrderItem selectTradeOrderItemById(Long id) {
        return tradeOrderItemMapper.selectTradeOrderItemById(id);
    }

    /**
     * 查询交易订单明细列表
     *
     * @param tradeOrderItem 交易订单明细
     * @return 交易订单明细
     */
    @Override
    public List<TradeOrderItem> selectTradeOrderItemList(TradeOrderItem tradeOrderItem) {
        return tradeOrderItemMapper.selectTradeOrderItemList(tradeOrderItem);
    }

    /**
     * 新增交易订单明细
     *
     * @param tradeOrderItem 交易订单明细
     * @return 结果
     */
    @Override
    public int insertTradeOrderItem(TradeOrderItem tradeOrderItem) {
        tradeOrderItem.setCreateTime(DateUtils.getNowDate());
        return tradeOrderItemMapper.insertTradeOrderItem(tradeOrderItem);
    }

    /**
     * 修改交易订单明细
     *
     * @param tradeOrderItem 交易订单明细
     * @return 结果
     */
    @Override
    public int updateTradeOrderItem(TradeOrderItem tradeOrderItem) {
        tradeOrderItem.setUpdateTime(DateUtils.getNowDate());
        return tradeOrderItemMapper.updateTradeOrderItem(tradeOrderItem);
    }

    /**
     * 删除交易订单明细信息
     *
     * @param id 交易订单明细主键
     * @return 结果
     */
    @Override
    public int deleteTradeOrderItemById(Long id) {
        return tradeOrderItemMapper.deleteTradeOrderItemById(id);
    }
}
